package com.dys.testjdk12;

import java.text.NumberFormat;
import java.util.Locale;

/**
 * @className: com.dys.testjdk12.NumberFormatTest
 * @description: JAVA12数字压缩格式化
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/09/08 下午8:35
 */
public class NumberFormatTest {
    /**
     * 这是一个main()方法,是应用程序的入口
     *
     * @param args 方法的形参列表,是一个字符串数组,包含了从命令行传递给程序的参数
     */
    public static void main(String[] args) {
        // NumberFormat cnf = NumberFormat.getCompactNumberInstance(Locale.CHINA, NumberFormat.Style.SHORT);
        NumberFormat cnf = NumberFormat.getCompactNumberInstance(Locale.ENGLISH, NumberFormat.Style.SHORT);
        System.out.println(cnf.format(1_0000));
        System.out.println(cnf.format(1_9200));
        System.out.println(cnf.format(1_000_000));
        System.out.println(cnf.format(1L << 30));
        System.out.println(cnf.format(1L << 40));
        System.out.println(cnf.format(1L << 50));
    }
}
